package com.xxq.vo;


import com.xxq.enums.HttpCodeEnum;

public class ResponseVo {

    private Integer code;

    private String msg;

    private Object data;

    public ResponseVo(){}

    public static ResponseVo success(){
        return success(null);
    }

    public static ResponseVo success(Object data){
        ResponseVo r = new ResponseVo();
        r.setCode(HttpCodeEnum.CODE_200.getCode());
        r.setMsg(HttpCodeEnum.CODE_200.getMsg());
        r.setData(data);
        return r;
    }

    public static ResponseVo error(String errMsg){
        ResponseVo r = new ResponseVo();
        r.setCode(HttpCodeEnum.CODE_500.getCode());
        r.setMsg(errMsg);
        return r;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
